<template>
	<view class="gerenziliao">
		<headertop title="编辑个人资料" str1="oridei" :back1="back1"></headertop>
		<view class="gerenziliaoback">

		</view>
		<view class="" :style="{'margin-top':statusBarHeight+'px','width':'100%','height':barHeight+'px'}">
		</view>
		<view class="bottomContent">
			<view class="jbxx">
				<view class="mould1">
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>与自己的关系：</span>
						</view>
						<view class="righthd" @click="open('与自己的关系')">
							<input type="text" v-model="formDate.relationship" :disabled="true" placeholder="请选择关系"
								v-if="!numtext('relationship',formDate.relationship)" />
							<span v-else>{{numtext('relationship',formDate.relationship)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>姓名：</span>
						</view>
						<view class="righthd">
							<input type="text" cursor-spacing="100" v-model="formDate.user_name" placeholder="请输入姓名" />
						</view>
					</view>
					<view class="centerline" @click="open('性别')">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>性别：</span>
						</view>
						<view class="righthd">
							<input type="text" v-if="!numtext('gender',formDate.gender)" v-model="formDate.gender"
								:disabled="true" placeholder="请选择性别" />
							<span v-else>{{numtext('gender',formDate.gender)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>出生日期：</span>
						</view>
						<view class="righthd" @click="open('出生日期')">
							<image :src="_static('/images/riliicon.png')" class="righthdicon" mode="">
							</image>
							<span style="color: #86909C;margin-right: 10rpx;">{{formDate['birthday']||'请选择时间'}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>身高：</span>
						</view>
						<view class="righthd">
							<input type="digit" cursor-spacing="100" v-model="formDate['height']"
								placeholder="请输入身高" />cm
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>体重：</span>
						</view>
						<view class="righthd">
							<input type="digit" cursor-spacing="100" v-model="formDate['weight']"
								placeholder="请输入体重" />kg
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>BMI：</span>
						</view>
						<view class="righthd">
							<input type="text" cursor-spacing="100" v-model="formDate['bmi']" placeholder="自动计算"
								:disabled="true" />
						</view>
					</view>
					<view class="centerline">
						<view style="width: 100%;overflow: hidden;">
							<view
								style="width: 100%;overflow: hidden;display: flex;align-items: center;margin-top: 24rpx;justify-content: space-between;">
								<view class="lable">
									<span style="color: #F53F3F;">*</span>
									<span>症状：</span>
								</view>
								<view class="righthd" style="color: #86909C;">

								</view>
							</view>
							<view
								style="margin-top: 16rpx;width: 100%;margin-left: 16rpx;display: flex;align-items: center;flex-wrap: wrap;">
								<view :class="!symptomarr.length?'xz':''"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;"
									@click="symptomarr=[]">
									暂无
								</view>
								<view :class="indfunbool(symptomarr,'流鼻涕')!=-1?'xz':''" @click="ll('流鼻涕')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									流鼻涕
								</view>
								<view :class="indfunbool(symptomarr,'打喷嚏')!=-1?'xz':''" @click="ll('打喷嚏')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									打喷嚏
								</view>
								<view :class="indfunbool(symptomarr,'鼻塞')!=-1?'xz':''" @click="ll('鼻塞')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									鼻塞
								</view>
								<view :class="indfunbool(symptomarr,'鼻痒')!=-1?'xz':''" @click="ll('鼻痒')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									鼻痒
								</view>
								<view :class="indfunbool(symptomarr,'胸闷')!=-1?'xz':''" @click="ll('胸闷')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									胸闷
								</view>
								<view :class="indfunbool(symptomarr,'心慌')!=-1?'xz':''" @click="ll('心慌')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									心慌
								</view>
								<view :class="indfunbool(symptomarr,'呼吸困难')!=-1?'xz':''" @click="ll('呼吸困难')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									呼吸困难
								</view>
							</view>

						</view>
					</view>

					<view class="centerline" @click="open('初次就诊时间')">
						<view class="lable">
							<span style="color: #F53F3F;">*</span>
							<span>初次就诊时间：</span>
						</view>
						<view class="righthd">
							<image :src="_static('/images/riliicon.png')" class="righthdicon" mode="">
							</image>
							<span
								style="color: #86909C;margin-right: 10rpx;">{{formDate.first_illness_date||'请选择时间'}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
				</view>
				<view class="mould1" style="margin-top: 32rpx;">
					<view class="centerline">
						<view class="lable">
							<span>手机号：</span>
						</view>
						<view class="righthd">
							<input type="number" cursor-spacing="100" v-model="formDate['mobile']"
								placeholder="请输入手机号" />
						</view>
					</view>
					<!-- 	<view class="centerline" @click="open('证件类型')">
						<view class="lable">
							<span>证件类型：</span>
						</view>
						<view class="righthd">
							<input type="text" v-model="formDate['card_type']" :disabled="true" placeholder="请选择类型"
								v-if="!numtext('card_type',formDate.card_type)" />
							<span v-else>{{numtext('card_type',formDate.card_type)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view> -->
					<!-- 		<view class="centerline">
						<view class="lable">
							<span>身份证号：</span>
						</view>
						<view class="righthd">
							<input type="text" cursor-spacing="100" v-model="formDate['card_no']"
								placeholder="请输入证件号" />
						</view>
					</view> -->
				</view>
				<view class="mould1" style="margin-top: 32rpx;">
					<view class="centerline">
						<view class="lable">
							<span>是否吸烟：</span>
						</view>
						<view class="righthd" @click="open('是否吸烟')">
							<input type="text" v-model="formDate['is_smoke']" :disabled="true" placeholder="请选择"
								v-if="!numtext('is_smoke',formDate.is_smoke)" />
							<span v-else>{{numtext('is_smoke',formDate.is_smoke)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
					<view class="centerline">
						<view class="lable">
							<span>是否酗酒：</span>
						</view>
						<view class="righthd" @click="open('是否酗酒')">
							<input type="text" v-model="formDate['is_drinking']" :disabled="true" placeholder="请选择"
								v-if="!numtext('is_drinking',formDate.is_drinking)" />
							<span v-else>{{numtext('is_drinking',formDate.is_drinking)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
				</view>
				<view class="mould1" style="margin-top: 32rpx;">
					<view class="centerline" @click="open('肝功能')">
						<view class="lable">
							<span>肝功能：</span>
						</view>
						<view class="righthd">
							<input type="text" v-model="formDate['liver']" :disabled="true" placeholder="请选择"
								v-if="!numtext('liver',formDate.liver)" />
							<span v-else>{{numtext('liver',formDate.liver)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
					<view class="centerline" @click="open('生育状况')">
						<view class="lable">
							<span>生育状况：</span>
						</view>
						<view class="righthd">
							<input type="text" v-model="formDate['fertility_status']" :disabled="true" placeholder="请选择"
								v-if="!numtext('fertility_status',formDate.fertility_status)" />
							<span v-else>{{numtext('fertility_status',formDate.fertility_status)}}</span>
							<image :src="_static('/images/Frjt.png')" class="rightarrow" mode="">
							</image>
						</view>
					</view>
				</view>
				<view class="mould1" style="margin-top: 32rpx;">
					<view class="centerline">
						<view style="width: 100%;overflow: hidden;">
							<view
								style="width: 100%;overflow: hidden;display: flex;align-items: center;margin-top: 24rpx;justify-content: space-between;">
								<view class="lable">
									<span>既往史：</span>
								</view>
							</view>
							<view
								style="margin-top: 16rpx;width: 600rpx;margin-left: 16rpx;display: flex;align-items: center;flex-wrap: wrap;border-bottom:2rpx solid #F2F3F5;">
								<view :class="!past_historyarr.length?'xz':''" @click="past_historyarr=[]"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									暂无
								</view>
								<view @click="ll1('鼻息肉')" :class="indfunbool(past_historyarr,'鼻息肉')!=-1?'xz':''"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									鼻息肉
								</view>
								<view :class="indfunbool(past_historyarr,'荨麻疹')!=-1?'xz':''" @click="ll1('荨麻疹')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									荨麻疹
								</view>
								<view :class="indfunbool(past_historyarr,'皮肤瘙痒')!=-1?'xz':''" @click="ll1('皮肤瘙痒')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									皮肤瘙痒
								</view>
								<view :class="indfunbool(past_historyarr,'咳嗽')!=-1?'xz':''" @click="ll1('咳嗽')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									咳嗽
								</view>
								<view :class="indfunbool(past_historyarr,'哮喘')!=-1?'xz':''" @click="ll1('哮喘')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									哮喘
								</view>
								<view :class="indfunbool(past_historyarr,'过敏性紫癜')!=-1?'xz':''" @click="ll1('过敏性紫癜')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									过敏性紫癜
								</view>
								<view :class="indfunbool(past_historyarr,'异位性皮炎')!=-1?'xz':''" @click="ll1('异位性皮炎')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									异位性皮炎
								</view>
								<view :class="indfunbool(past_historyarr,'川崎病')!=-1?'xz':''" @click="ll1('川崎病')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									川崎病
								</view>
								<view :class="indfunbool(past_historyarr,'湿疹')!=-1?'xz':''" @click="ll1('湿疹')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									湿疹
								</view>
							</view>

							<view
								style="width: 100%;overflow: hidden;display: flex;align-items: center;margin-top: 24rpx;justify-content: space-between;">
								<view class="lable">
									<span>家族病史：</span>
								</view>
							</view>
							<view
								style="margin-top: 16rpx;width: 600rpx;margin-left: 16rpx;display: flex;align-items: center;flex-wrap: wrap;border-bottom:2rpx solid #F2F3F5;">
								<view :class="!family_historyarr.length?'xz':''" @click="family_historyarr=[]"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									暂无
								</view>
								<view :class="indfunbool(family_historyarr,'过敏性鼻炎')!=-1?'xz':''" @click="ll2('过敏性鼻炎')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									过敏性鼻炎
								</view>
								<view :class="indfunbool(family_historyarr,'过敏性哮喘')!=-1?'xz':''" @click="ll2('过敏性哮喘')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									过敏性哮喘
								</view>
								<view :class="indfunbool(family_historyarr,'异位性皮炎')!=-1?'xz':''" @click="ll2('异位性皮炎')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									异位性皮炎
								</view>
								<view :class="indfunbool(family_historyarr,'食物过敏')!=-1?'xz':''" @click="ll2('食物过敏')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									食物过敏
								</view>
								<view :class="indfunbool(family_historyarr,'药物过敏')!=-1?'xz':''" @click="ll2('药物过敏')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									药物过敏
								</view>
								<view :class="indfunbool(family_historyarr,'花粉过敏皮炎')!=-1?'xz':''" @click="ll2('花粉过敏皮炎')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									花粉过敏皮炎
								</view>

								<view :class="indfunbool(family_historyarr,'荨麻疹')!=-1?'xz':''" @click="ll2('荨麻疹')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									荨麻疹
								</view>
								<view :class="indfunbool(family_historyarr,'过敏性结膜炎')!=-1?'xz':''" @click="ll2('过敏性结膜炎')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									过敏性结膜炎
								</view>
								<view :class="indfunbool(family_historyarr,'湿疹')!=-1?'xz':''" @click="ll2('湿疹')"
									style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
									湿疹
								</view>
							</view>

							<view style="width: 100%;overflow: hidden;border-bottom:2rpx solid #F2F3F5;">
								<view
									style="width: 100%;overflow: hidden;display: flex;align-items: center;margin-top: 24rpx;justify-content: space-between;">
									<view class="lable">
										<span>药物过敏：</span>
									</view>
								</view>
								<view
									style="margin-top: 16rpx;width: 600rpx;margin-left: 16rpx;display: flex;align-items: center;flex-wrap: wrap;">
									<view :class="!drug_allergyarr.length?'xz':''" @click="drug_allergyarr=[]"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										暂无
									</view>
									<view :class="indfunbool(drug_allergyarr,'解热镇痛药')!=-1?'xz':''" @click="ll3('解热镇痛药')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										解热镇痛药
									</view>
									<view :class="indfunbool(drug_allergyarr,'磺胺')!=-1?'xz':''" @click="ll3('磺胺')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										磺胺
									</view>
									<view :class="indfunbool(drug_allergyarr,'抗生素')!=-1?'xz':''" @click="ll3('抗生素')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										抗生素
									</view>
									<view :class="indfunbool(drug_allergyarr,'精神类药物')!=-1?'xz':''" @click="ll3('精神类药物')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										精神类药物
									</view>
									<view :class="indfunbool(drug_allergyarr,'其他药物')!=-1?'xz':''" @click="ll3('其他药物')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										其他药物
									</view>
								</view>
							</view>
							<view style="width: 100%;overflow: hidden;">
								<view
									style="width: 100%;overflow: hidden;display: flex;align-items: center;margin-top: 24rpx;justify-content: space-between;">
									<view class="lable">
										<span>食物过敏：</span>
									</view>
								</view>
								<view
									style="margin-top: 16rpx;width: 100%;margin-left: 16rpx;display: flex;align-items: center;flex-wrap: wrap;">
									<view :class="!food_allergyarr.length?'xz':''" @click="food_allergyarr=[]"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										暂无
									</view>
									<view :class="indfunbool(food_allergyarr,'鸡蛋')!=-1?'xz':''" @click="ll4('鸡蛋')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										鸡蛋
									</view>
									<view :class="indfunbool(food_allergyarr,'牛奶')!=-1?'xz':''" @click="ll4('牛奶')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										牛奶
									</view>
									<view :class="indfunbool(food_allergyarr,'海鲜类')!=-1?'xz':''" @click="ll4('海鲜类')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										海鲜类
									</view>
									<view :class="indfunbool(food_allergyarr,'鱼')!=-1?'xz':''" @click="ll4('鱼')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										鱼
									</view>
									<view :class="indfunbool(food_allergyarr,'坚果')!=-1?'xz':''" @click="ll4('坚果')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										坚果
									</view>
									<view :class="indfunbool(food_allergyarr,'花生')!=-1?'xz':''" @click="ll4('花生')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										花生
									</view>
									<view :class="indfunbool(food_allergyarr,'豆类')!=-1?'xz':''" @click="ll4('豆类')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										豆类
									</view>
									<view :class="indfunbool(food_allergyarr,'面粉')!=-1?'xz':''" @click="ll4('面粉')"
										style="padding:6rpx 28rpx;background: #F2F3F5;border-radius: 4rpx 4rpx 4rpx 4rpx;color: #86909C;margin-right: 28rpx;margin-bottom: 20rpx;font-size: 24rpx;">
										面粉
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<up-popup :show="show" mode="bottom">
			<view class="xuanxiang">
				<view class="tt" style="margin-left: 30rpx;color: #888;" @click="show=false">
					取消
				</view>
				<view class="tt" style="font-weight: 600;">
					{{titlepopu}}
				</view>
				<view class="tt" style="margin-right: 30rpx;color: #0077BE;" @click="queding">
					确认
				</view>
			</view>
			<picker-view :indicator-style="indicatorStyle" immediate-change="true"
				:value="zhuanind(arr,formDate.relationship)" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择与自己的关系'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in arr" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>


			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="zhuanind(arr1,formDate.card_type)" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择证件类型'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in arr1" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>

			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="zhuanind(arr2,formDate['is_smoke'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择是否酗酒'||titlepopu=='请选择是否吸烟'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in arr2" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>
			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="zhuanind(arr3,formDate['liver'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择肝功能'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in arr3" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>
			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="zhuanind(arr3,formDate['liver'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择生育状况'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in arr4" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>

			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="zhuanind(xingbie,formDate['gender'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择性别'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in xingbie" :key="index">{{item.name}}</view>
				</picker-view-column>
			</picker-view>
			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="nianyuefun(formDate['birthday'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择出生日期'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
				</picker-view-column>
				<picker-view-column>
					<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
				</picker-view-column>
				<picker-view-column>
					<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
				</picker-view-column>
			</picker-view>
			<picker-view immediate-change="true" :indicator-style="indicatorStyle"
				:value="nianyuefun(formDate['first_illness_date'])" @change="bindChange" class="picker-view"
				v-if="titlepopu=='请选择初次就诊时间'">
				<picker-view-column>
					<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
				</picker-view-column>
				<picker-view-column>
					<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
				</picker-view-column>
				<picker-view-column>
					<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
				</picker-view-column>

			</picker-view>
		</up-popup>
		<view class="fixed">
			<view class="btn" @click="savezl">
				保存资料
			</view>
		</view>
		<view class="" style="height: 210rpx;">

		</view>
	</view>
</template>

<script setup>
	import headertop from '@/components/header.vue'
	import {
		_static
	} from '@/ulm/utils/url.js'
	import {
		ref,
		reactive,
		onMounted,
		watch
	} from 'vue'
	import {
		onPageScroll,
		onLoad,
		onShow,
		onReachBottom
	} from "@dcloudio/uni-app";
	import {
		$api
	} from '../../ulm';
	const date = new Date()
	const years = []
	const year = date.getFullYear()
	const months = []
	const symptomarr = ref([])
	const month = date.getMonth() + 1
	const days = []
	const day = date.getDate()
	const valuedate = ref([9999, month - 1, day - 1])
	for (let i = 1900; i <= date.getFullYear(); i++) {
		years.push(i)
	}
	for (let i = 1; i <= 12; i++) {
		months.push(i)
	}
	for (let i = 1; i <= 31; i++) {
		days.push(i)
	}
	const statusBarHeight = ref('')
	const barHeight = ref('')
	const drug_allergyarr = ref([])
	const back1 = ref('')
	const arr = reactive([{
		'name': '本人',
		id: 1
	}, {
		'name': '父母',
		id: 2
	}, {
		'name': '子女',
		id: 3
	}, {
		'name': '爱人',
		id: 4
	}, {
		'name': '其他',
		id: 5
	}])
	const arr1 = reactive([{
		'name': '身份证',
		id: 1
	}, {
		'name': '港澳通行证',
		id: 2
	}, {
		'name': '签证',
		id: 3
	}])

	const arr2 = reactive([{
		'name': '否',
		id: 0
	}, {
		'name': '是',
		id: 1
	}])

	const arr3 = reactive([{
		'name': '正常',
		id: 1
	}, {
		'name': '异常',
		id: 2
	}])
	const arr4 = reactive([{
		'name': '未生育',
		id: 0
	}, {
		'name': '已生育',
		id: 1
	}])

	const xingbie = reactive([{
		'name': '男',
		id: '1'
	}, {
		'name': '女',
		id: '0'
	}])
	const food_allergyarr = ref([])
	const past_historyarr = ref([])
	const indicatorStyle = ref(`height: 50px;`)
	const value1 = ref(0)
	const active = ref(2)
	const titlepopu = ref('')
	const show = ref(false)
	const relationshipval = ref('')
	const genderval = ref('')
	const birthdayval = ref('')
	const first_illness_dateval = ref('')
	const card_typeval = ref('')
	const is_smokeval = ref('')
	const is_drinkingval = ref('')
	const liverval = ref('')
	const fertility_statusval = ref('')
	const family_historyarr = ref([])
	const formDate = reactive({
		relationship: '',
		user_name: '',
		gender: undefined,
		birthday: '',
		height: '',
		weight: '',
		bmi: '',
		symptom: '',
		first_illness_date: '',
		mobile: '',
		card_no: '',
		card_type: '',
		is_smoke: undefined,
		is_drinking: undefined,
		liver: '',
		fertility_status: undefined,
		past_history: '',
		drug_allergy: '',
		family_history: '',
		food_allergy: '',
	})
	watch(() => formDate.height, (newval, oldval) => {
		if (newval && formDate.weight) {
			var bmi = formDate.weight / (newval / 100 * newval / 100)
			if (bmi) {
				formDate.bmi = Number(bmi).toFixed(2)
			} else {
				formDate.bmi = ''
			}
		}
	})
	watch(() => formDate.weight, (newval, oldval) => {
		if (newval && formDate.height) {
			var bmi = newval / (formDate.height / 100 * formDate.height / 100)
			if (bmi) {
				formDate.bmi = Number(bmi).toFixed(2)
			} else {
				formDate.bmi = ''
			}
		}
	})
	onMounted(() => {
		statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
		const {
			top,
			height
		} = wx.getMenuButtonBoundingClientRect();
		barHeight.value = height ? height + (top - statusBarHeight.value) * 2 : 38;
	})
	onPageScroll((e) => {
		if (e.scrollTop > 100) {
			back1.value = '#81D6FF'
		} else {
			back1.value = ''
		}
	})
	onLoad(() => {
		init()
	})

	function nianyuefun(str) {
		if (!str) {
			return [9999, month - 1, day - 1]
		} else {
			var arr = str.split('-')
			var ind1 = years.findIndex(item => item == arr[0])
			var ind2 = months.findIndex(item => item == arr[1])
			var ind3 = days.findIndex(item => item == arr[2])
			return [ind1, ind2, ind3]
		}

	}

	function ll(str) {
		var ind = symptomarr.value.findIndex(item => item == str)
		if (ind == -1) {
			symptomarr.value.push(str)
		} else {
			symptomarr.value.splice(ind, 1)
		}
	}

	function ll1(str) {
		var ind = past_historyarr.value.findIndex(item => item == str)
		if (ind == -1) {
			past_historyarr.value.push(str)
		} else {
			past_historyarr.value.splice(ind, 1)
		}
	}

	function ll2(str) {
		var ind = family_historyarr.value.findIndex(item => item == str)
		if (ind == -1) {
			family_historyarr.value.push(str)
		} else {
			family_historyarr.value.splice(ind, 1)
		}
	}

	function ll3(str) {
		var ind = drug_allergyarr.value.findIndex(item => item == str)
		if (ind == -1) {
			drug_allergyarr.value.push(str)
		} else {
			drug_allergyarr.value.splice(ind, 1)
		}
	}

	function ll4(str) {
		var ind = food_allergyarr.value.findIndex(item => item == str)
		if (ind == -1) {
			food_allergyarr.value.push(str)
		} else {
			food_allergyarr.value.splice(ind, 1)
		}
	}


	function indfunbool(arr, str) {
		var ind = arr.findIndex(item => item == str)
		return ind
	}

	function zhuanind(arr, ite) {
		var ind = arr.findIndex(item => item['id'] == ite)
		if (ind == -1) {
			ind = 0
		}
		return [ind]
	}
	async function init() {
		const res = await $api.userinfo()
		if (res.code == 1) {
			if (res.data) {
				Object.keys(res.data).forEach(key => {
					formDate[key] = res.data[key]
				})
			}
			relationshipval.value = formDate['relationship']
			genderval.value = formDate['gender']
			card_typeval.value = formDate['card_type']
			if (formDate['symptom']) {
				symptomarr.value = formDate['symptom'].split(',')
			}
			if (formDate['past_history']) {
				past_historyarr.value = formDate['past_history'].split(',')
			}
			if (formDate['family_history']) {
				family_historyarr.value = formDate['family_history'].split(',')
			}
			if (formDate['drug_allergy']) {
				drug_allergyarr.value = formDate['drug_allergy'].split(',')
			}
			if (formDate['food_allergy']) {
				food_allergyarr.value = formDate['food_allergy'].split(',')
			}


			is_drinkingval.value = formDate['is_drinking']
			is_smokeval.value = formDate['is_smoke']
			liverval.value = formDate['liver']
			fertility_statusval.value = formDate['fertility_status']
			birthdayval.value = formDate['birthday']
			first_illness_dateval.value = formDate['first_illness_date']
		}
	}
	async function savezl() {
		if (!formDate.relationship || !formDate.user_name || !formDate.gender || !formDate.birthday || !formDate
			.height || !formDate.weight || !formDate.bmi || !formDate.first_illness_date) {
			uni.showToast({
				title: '必填项不能为空',
				icon: 'none'
			})
			return
		}
		if (formDate['card_no']) {
			const reg = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
			if (!reg.test(formDate['card_no'])) {
				uni.showToast({
					title: '身份证格式错误',
					icon: 'none'
				})
				return
			}
		}
		const reg1 = /^1[3-9]\d{9}$/;
		if (formDate['mobile']) {

			if (!reg1.test(formDate['mobile'])) {
				uni.showToast({
					title: '手机号格式错误',
					icon: 'none'
				})
				return
			}
		}
		formDate.family_history = family_historyarr.value.join()
		formDate.drug_allergy = drug_allergyarr.value.join()
		formDate.food_allergy = food_allergyarr.value.join()
		formDate.symptom = symptomarr.value.join()
		formDate.past_history = past_historyarr.value.join()
		const res = await $api.userprofile(formDate)
		if (res.code == 1) {
			setTimeout(function() {
				uni.showToast({
					title: '保存成功',
					icon: 'none'
				})
			}, 500);
			uni.navigateBack();
		} else {
			uni.showToast({
				title: res.msg,
				icon: 'none'
			})
		}

	}

	function numtext(typestr, id) {
		if (typestr == 'relationship') {
			var ind = arr.findIndex(item => item.id == id)
			if (ind == -1) {
				return ''
			} else {
				return arr[ind]['name']
			}
		} else if (typestr == 'card_type') {
			var ind = arr1.findIndex(item => item.id == id)
			if (ind == -1) {
				return ''
			} else {
				return arr1[ind]['name']
			}
		} else if (typestr == 'card_type') {
			var ind = arr1.findIndex(item => item.id == id)
			if (ind == -1) {
				return ''
			} else {
				return arr1[ind]['name']
			}
		} else if (typestr == 'is_smoke') {
			var ind = arr2.findIndex(item => item.id == id)
			if (ind == -1 && id != 0) {
				return ''
			} else {
				return arr2[ind]['name']
			}
		} else if (typestr == 'is_drinking') {
			var ind = arr2.findIndex(item => item.id == id)
			if (ind == -1 && id != 0) {
				return ''
			} else {
				return arr2[ind]['name']
			}
		} else if (typestr == 'liver') {
			var ind = arr3.findIndex(item => item.id == id)
			if (ind == -1) {
				return ''
			} else {
				return arr3[ind]['name']
			}
		} else if (typestr == 'fertility_status') {
			var ind = arr4.findIndex(item => item.id == id)

			if (ind == -1 && id != 0) {
				return ''
			} else {
				return arr4[ind]['name']
			}
		} else if (typestr == 'gender') {
			var ind = xingbie.findIndex(item => item.id == id)

			if (ind == -1) {
				return ''
			} else {
				return xingbie[ind]['name']
			}
		}


	}

	function open(str) {
		titlepopu.value = '请选择' + str
		show.value = true
	}

	function bindChange(e) {
		const val = e.detail.value
		if (titlepopu.value == '请选择与自己的关系') {
			relationshipval.value = arr[val[0]]['id']
		} else if (titlepopu.value == '请选择证件类型') {
			card_typeval.value = arr1[val[0]]['id']
		} else if (titlepopu.value == '请选择是否酗酒') {
			is_drinkingval.value = arr2[val[0]]['id']
		} else if (titlepopu.value == '请选择是否吸烟') {

			is_smokeval.value = arr2[val[0]]['id']
		} else if (titlepopu.value == '请选择肝功能') {
			liverval.value = arr3[val[0]]['id']
		} else if (titlepopu.value == '请选择性别') {
			genderval.value = xingbie[val[0]]['id']
		} else if (titlepopu.value == '请选择生育状况') {
			fertility_statusval.value = arr4[val[0]]['id']
		} else if (titlepopu.value == '请选择出生日期') {
			birthdayval.value =
				`${years[val[0]]}-${months[val[1]]<10?'0'+months[val[1]]:months[val[1]]}-${days[val[2]]<10?'0'+days[val[2]]:days[val[2]]}`
		} else if (titlepopu.value == '请选择初次就诊时间') {
			first_illness_dateval.value =
				`${years[val[0]]}-${months[val[1]]<10?'0'+months[val[1]]:months[val[1]]}-${days[val[2]]<10?'0'+days[val[2]]:days[val[2]]}`
		}

	}

	function queding() {
		if (titlepopu.value == '请选择与自己的关系') {
			if (!relationshipval.value) {
				formDate['relationship'] = arr[0]['id']
			} else {
				formDate['relationship'] = relationshipval.value
			}
		} else if (titlepopu.value == '请选择证件类型') {
			if (!card_typeval.value) {
				formDate['card_type'] = arr1[0]['id']
			} else {
				formDate['card_type'] = card_typeval.value
			}
		} else if (titlepopu['value'] == '请选择是否酗酒') {
			if (!is_drinkingval.value) {
				formDate['is_drinking'] = arr2[0]['id']
			} else {
				formDate['is_drinking'] = is_drinkingval.value
			}
		} else if (titlepopu.value == '请选择是否吸烟') {
			if (!is_smokeval.value) {
				formDate['is_smoke'] = arr2[0]['id']
			} else {
				formDate['is_smoke'] = is_smokeval.value
			}
		} else if (titlepopu.value == '请选择肝功能') {
			if (!liverval.value) {
				formDate['liver'] = arr3[0]['id']
			} else {
				formDate['liver'] = liverval.value
			}
		} else if (titlepopu.value == '请选择性别') {
			if (!genderval.value) {
				formDate['gender'] = xingbie[0]['id']
			} else {
				formDate['gender'] = genderval.value
			}
		} else if (titlepopu.value == '请选择生育状况') {
			if (!fertility_statusval.value) {
				formDate['fertility_status'] = arr4[0]['id']
			} else {
				formDate['fertility_status'] = fertility_statusval.value
			}
		} else if (titlepopu.value == '请选择出生日期') {
			if (!birthdayval.value) {
				formDate['birthday'] =
					`${date.getFullYear()}-${months[month-1]<10?'0'+months[month-1]:months[month-1]}-${day<10?'0'+day:day}`
			} else {
				formDate['birthday'] = birthdayval.value
				if (convertToTimestamp(formDate['birthday']) > Date.now()) {
					formDate['birthday'] = ''
					uni.showToast({
						title: '请选择正确出生日期',
						icon: 'none'
					})
					return
				}
			}
		} else if (titlepopu.value == '请选择初次就诊时间') {
			if (!first_illness_dateval.value) {
				formDate['first_illness_date'] =
					`${date.getFullYear()}-${months[month-1]<10?'0'+months[month-1]:months[month-1]}-${day<10?'0'+day:day}`
			} else {
				formDate['first_illness_date'] = first_illness_dateval.value
				if (convertToTimestamp(formDate['first_illness_date']) > Date.now()) {
					formDate['first_illness_date'] = ''
					uni.showToast({
						title: '请选择正确的初次就诊时间',
						icon: 'none'
					})
					return
				}
			}
		}

		show.value = false
	}

	function convertToTimestamp(dateStr) {
		return new Date(dateStr).getTime();
	}
</script>

<style lang="scss">
	.xz {
		background: #EAF8FF !important;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-size: 24rpx;
		color: #2AB4F5 !important;
	}

	.picker-view {
		width: 100%;
		height: 600rpx;
		margin-top: 20rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 0 0;
	}

	.item {
		line-height: 100rpx;
		text-align: center;
	}

	::v-deep .u-popup__content {
		border-radius: 20rpx 20rpx 0 0;
	}

	page {
		background: #F7F8FA;
	}

	.xuanxiang {
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 30rpx;
		overflow: hidden;
		justify-content: space-between;
		margin-bottom: 30rpx;

		.tt {
			font-size: 32rpx;
		}
	}

	.fixed {
		width: 100%;
		height: 194rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -6rpx 14rpx 0rpx rgba(0, 0, 0, 0.03);
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: fixed;
		bottom: 0%;
		z-index: 99;

		.btn {
			width: 686rpx;
			height: 82rpx;
			background: #2AB4F5;
			border-radius: 12rpx 12rpx 12rpx 12rpx;
			text-align: center;
			line-height: 82rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FFFFFF;
			margin: auto;
			margin-top: 32rpx;
		}
	}

	.gerenziliao {
		width: 100%;
		overflow: hidden;
		position: relative;

		.gerenziliaoback {
			width: 100%;
			height: 450rpx;
			background: linear-gradient(180deg, #CAEEFF 71%, rgba(240, 250, 255, 0) 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: absolute;
			z-index: -1;
		}

		.bottomContent {
			width: 100%;
			overflow: hidden;
			margin-top: 32rpx;

			.jbxx {
				width: 686rpx;
				margin: auto;
				overflow: hidden;

				.mould1 .centerline:last-child {
					border: none !important;
				}

				.mould1 {
					width: 100%;
					box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.03);
					border-radius: 24rpx 24rpx 24rpx 24rpx;
					overflow: hidden;
					padding: 8rpx 0;
					background: #FFFFFF;

					.centerline {
						width: 630rpx;
						min-height: 88rpx;
						margin: auto;
						display: flex;
						align-items: center;
						justify-content: space-between;
						border-bottom: 2rpx solid #F2F3F5;

						.lable {
							font-size: 28rpx;
							color: #1D2129;
						}

						.righthd {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 28rpx;
							color: #1D2129;
							text-align: right;
							display: flex;
							align-items: center;

							.righthdicon {
								width: 32rpx;
								height: 30rpx;
								margin-right: 12rpx;
							}

							.rightarrow {
								width: 24rpx;
								height: 24rpx;
							}

							input {
								text-align: right;
								font-size: 28rpx;
							}
						}
					}
				}
			}
		}
	}
</style>